package gemini.basic.model;

// default package
// Generated Nov 23, 2010 4:23:01 PM by Hibernate Tools 3.4.0.Beta1

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Version;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * BuyOrder generated by hbm2java
 */
@Entity
@Table(name = "g_buy_order", catalog = "gemini")
public class BuyOrder extends AbstractDomain {

	private static final long serialVersionUID = 1L;
	
	private Integer id;
	private Integer version;
	private DiscountScale discountScale;
	private Order order;
	private List<ReturnOrder> returnOrders = new ArrayList<ReturnOrder>(0);

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "order"))
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "discount_id", nullable = false)
	public DiscountScale getDiscountScale() {
		return this.discountScale;
	}

	public void setDiscountScale(DiscountScale discountScale) {
		this.discountScale = discountScale;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Order getOrder() {
		return this.order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "buyOrder")
	public List<ReturnOrder> getReturnOrders() {
		return this.returnOrders;
	}

	public void setReturnOrders(List<ReturnOrder> returnOrders) {
		this.returnOrders = returnOrders;
	}

}
